﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

namespace Coldairarrow.Entity.Interface
{
    /// <summary>
    /// 钉钉流程单据数据
    /// </summary>
    public class ProcessDTO
    {
        /// <summary>
        /// 请求ID。
        /// </summary>
        public string request_id { get; set; }
        /// <summary>
        /// 返回码。
        /// </summary>
        public int errcode { get; set; }
        /// <summary>
        /// 返回码描述
        /// </summary>
        public string errmsg { get; set; }
        /// <summary>
        /// 审批流程ID
        /// </summary>
        public string process_instance_id { get; set; }
        /// <summary>
        /// 审批实例详情
        /// </summary>
        public process_instance process_instance { get; set; }

    }

    public class process_instance
    {
        /// <summary>
        /// 审批实例标题
        /// </summary>
        public string title { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        public string create_time { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        public string finish_time { get; set; }
        /// <summary>
        /// 发起人的userid
        /// </summary>
        public string originator_userid { get; set; }
        /// <summary>
        /// 发起人的部门。-1表示根部门。
        /// </summary>
        public string originator_dept_id { get; set; }
        /// <summary>
        /// 审批状态。NEW：新创建,RUNNING：审批中,TERMINATED：被终止,COMPLETED：完成,CANCELED：取消
        /// </summary>
        private string _status;
        public string status
        {
            get { return _status; }

            set
            {
                if (value == "NEW") _status = "新创建";
                else if (value == "RUNNING") _status = "审批中";
                else if (value == "TERMINATED") _status = "被终止";
                else if (value == "COMPLETED") _status = "完成";
                else if (value == "CANCELED") _status = "取消";

            }

        }
        /// <summary>
        /// 审批人userid。
        /// </summary>
        public List<string> approver_userids { get; set; }
        /// <summary>
        /// 抄送人userid。
        /// </summary>
        public List<string> cc_userids { get; set; }
        /// <summary>
        /// 发起人的部门。-1表示根部门。
        /// </summary>
        public string result { get; set; }
        /// <summary>
        /// 审批实例业务编号。
        /// </summary>
        public string business_id { get; set; }
        /// <summary>
        /// 操作记录列表。
        /// </summary>
        public List<operation_records> operation_records { get; set; }
        /// <summary>
        /// 任务列表。
        /// </summary>
        public List<tasks> tasks { get; set; }
        /// <summary>
        /// 发起部门。
        /// </summary>
        public string originator_dept_name { get; set; }
        /// <summary>
        /// 审批实例业务动作
        /// </summary>
        public string biz_action { get; set; }
        /// <summary>
        /// 审批附属实例列表，当已经通过的审批实例被修改或撤销，会生成一个新的实例，作为原有审批实例的附属。
        /// </summary>
        public List<string> attached_process_instance_ids { get; set; }
        /// <summary>
        /// 表单详情列表。
        /// </summary>
        public List<form_component_values> form_component_values { get; set; }
        /// <summary>
        /// 主流程实例标识。
        /// </summary>
        public string main_process_instance_id { get; set; }
    }

    /// <summary>
    /// 操作记录列表。
    /// </summary>
    public class operation_records
    {

        /// <summary>
        /// 操作人userid。	
        /// </summary>
        public string userid { get; set; }
        /// <summary>
        /// 操作时间。
        /// </summary>
        public string date { get; set; }
        /// <summary>
        /// 操作类型
        /// </summary>
        public string operation_type { get; set; }

        /// <summary>
        /// 操作结果
        /// </summary>
        public string operation_result { get; set; }
        /// <summary>
        /// 评论
        /// </summary>
        public string remark { get; set; }
    }

    /// <summary>
    /// 任务列表
    /// </summary>
    public class tasks
    {

        /// <summary>
        /// 任务处理人
        /// </summary>
        public string userid { get; set; }
        /// <summary>
        /// 任务状态：
        /// </summary>
        public string task_status { get; set; }
        /// <summary>
        /// 结果：
        /// </summary>
        public string task_result { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        public string create_time { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        public string finish_time { get; set; }
        /// <summary>
        /// 任务节点ID
        /// </summary>
        public string taskid { get; set; }
        /// <summary>
        /// 任务URL
        /// </summary>
        public string url { get; set; }

    }

    /// <summary>
    /// 表单详情列表
    /// </summary>
    public class form_component_values
    {
        /// <summary>
        /// 标签名
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 标签值
        /// </summary>
        public string value { get; set; }
        /// <summary>
        /// 标签扩展值
        /// </summary>
        public string ext_value { get; set; }
        /// <summary>
        /// 组件ID
        /// </summary>
        public string id { get; set; }
        /// <summary>
        /// 组件类型
        /// </summary>
        public string component_type { get; set; }
        /// <summary>
        /// 主流程实例标识
        /// </summary>
        public string main_process_instance_id { get; set; }
    }
}
